package com.example.demo.config;

import com.example.demo.pojo.Content;
import com.example.demo.util.HtmlParseUtil;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;
import java.net.URL;
import java.util.List;

/**
 * @Author: huanggaotao
 * @Description:
 * @Date: Created in 17:14 2021/7/26
 * @Modified By:
 */
@Configuration
public class ElasticSearchCilentConfig {

    //test
    @Bean
    public RestHighLevelClient getRestHighLevelClient(){
        RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(
                new HttpHost("127.0.0.1", 9200, "http")
        ));
        return client;
    }

//    public static void main(String[] args) throws IOException {
//        List<Content> java = new HtmlParseUtil().parseJD("java");
//        for (Content content : java) {
//            System.out.println(content);
//        }
//        }
}
